void trimWhitespace (char *c)
{
  char temp[255];
  int index = 0;
  int offset = 0;
  int trimStatus = 0; //Start trimming after first non-whitespace, do not trim first whitespace after token
  
  while (c[index] != '\0')
    {
      if (!(c[index] == ' ' || c[index] == '\f' || c[index] == '\n' || c[index] == '\r' || c[index] == '\v' || c[index] == '\t'))
	{
	  temp[index - offset] = c[index];
	  if (trimStatus == 0)
	    trimStatus = 1;
	}
      else
	{
	  if (trimStatus == 0 || trimStatus == 2)
	    offset++;
	  if (trimStatus == 1)
	    {
	      temp[index - offset] = ' ';
	      trimStatus = 0;
	    }
	}
      index++;
    }
  temp[index - offset] = '\0';
  strcpy(c, temp);
}

//PAGINATION
//determine height of string for comparison to $LINES
//retconned out, as $LINES is a LINUX only variable
int getStringHeight(char * c)
{
  int height = 1;
  int index = 0;
  while (c[index] != '\0')
    {
      if (c[index] == '\n')
	height++;
      index++;
    }
  return height;
}

//Prints in pagination format
void page_printer(char * c, int maxLines)
{
  char * garbage;
  int currentLines = 0;
  int index        = 0;
  int offset       = 0;
  char temp[255];
  
 page:
  if(c[index] =='\0')
    goto exit;
  currentLines = 0;
  while(currentLines < maxLines && c[index] != '\0')
    {
      if(c[index] != '\n'){
	temp[index - offset] = c[index];}
      else{
	temp[index - offset] = '\0';
	printf("%s\n", temp);
	offset = index + 1;
	currentLines++;
      }
      index++;
    }
  printf("PRESS ENTER KEY TO DISPLAY NEXT PAGE\n");
  scanf("%c", garbage);
  goto page;
 exit: ;
}
